package control;

import database.Database;
import java.sql.SQLException;
import model.Telephone;

/**
 * Denne klasse håndterer manipulation af Telephone
 * @author Sonny Sandberg
 */
public abstract class TelephoneControl 
{
    /**
     * Tilføj telefon
     * @param Telephone
     * @return int
     * @throws SQLException
     * @throws ClassNotFoundException 
     */
    public static int addPhone(Telephone phone) throws SQLException, ClassNotFoundException
    {
        Database db = new Database();
        
        int added = db.manipulateDB("INSERT INTO bs_customer_telephone (number, fk_customer) VALUES ('"+phone.getNumber()+"', '"+phone.getCustomer().getId()+"')");
        db.closeDB();
        
        return added;
    }
}